package br.com.duosoftware.orcamento.entidades;

import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 *
 * @author Daniel
 * 
 */

@Entity
@Table(name="programas_periodos")
public class ProgramaPeriodo implements Serializable{
    
    @Id
    @GeneratedValue(strategy= GenerationType.IDENTITY)
    private Integer id;
    
    @ManyToOne
    @JoinColumn(name="programa_id")
    private Programa programa;
    
    @ManyToOne
    @JoinColumn(name="periodo_de_programa_id")
    private PeriodoDePrograma periodoDePrograma;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }
    
    public Programa getPrograma() {
        return programa;
    }

    public void setPrograma(Programa programa) {
        this.programa = programa;
    }

    public PeriodoDePrograma getPeriodoDePrograma() {
        return periodoDePrograma;
    }

    public void setPeriodoDePrograma(PeriodoDePrograma periodoDePrograma) {
        this.periodoDePrograma = periodoDePrograma;
    }

    @Override
    public int hashCode() {
        int hash = 5;
        hash = 67 * hash + (this.programa != null ? this.programa.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ProgramaPeriodo other = (ProgramaPeriodo) obj;
        if (this.programa != other.programa && (this.programa == null || !this.programa.equals(other.programa))) {
            return false;
        }
        return true;
    }
    
}
